<?php get_instance()->view('common/header');?>
<body class="bag3">
<div class="weninfoconsbox p3 bag1">
    <h2 class="f14 fb pt10 mb5"><?php echo $info['title']?></h2>
    <p class="lh22 f09"><?php echo $info['content']?></p>
    <?php if (!empty($info['pic'])):?>
    <p class="lh22 f09">图片如下：</p>
    <div class="threebox mt10 hengline imginfobox imgboxpull pb10">
        <?php foreach ($info['pic'] as $k => $v):?>
            <img src="<?php echo $v?>" alt="">
        <?php endforeach;?>
    </div>
    <?php endif;?>
</div>
<div class="weui-cells m5_0">
    <?php if (!empty($info['attr'])): foreach ($info['attr'] as $k => $v):?>
    <a class="weui-cell weui-cell_access" href="javascript:;">
        <div class="weui-cell__bd p5_0">
            <p class="f08"><?php echo $v['attr_name']?>：<?php echo $v['attr_value']?></p>
        </div>
    </a>
    <?php endforeach; endif;?>
</div>
<div class="weui-cells m5_0"> 
    <a class="weui-cell weui-cell_access" href="<?php echo getUrl('find/index?id='.$info['consumer_id'])?>">
        <div class="weui-cell__bd p5_0">
            <div class="hengleft bag1">
                <div class="minuserimg imgbox"><img src="<?php echo $info['portrait']?>" alt=""></div>
                <div class="">
                    <h1><?php echo $info['nickname']?> <?php echo $info['mobile']?></h1>
                    <p class="f08 cor6"><?php echo $info['desc']?></p>
                </div>
            </div>
        </div>
        <div class="weui-cell__ft"></div>
    </a>
    <a class="weui-cell weui-cell_access" href="javascript:;">
        <div class="weui-cell__bd p5_0 wp80">
            <p class="f08 textEll">位置：<?php echo $info['address_name']?></p>
        </div>
        <div class="weui-cell__ft"></div>
    </a>
</div>

<div class="bag1 pb50">
    <?php if (!empty($info['comment'])): foreach ($info['comment'] as $k => $v):?>
        <div class="userhuifu bor_bb">
            <div class="hengleft">
                <div class="minuserimg imgbox"><img src="<?php echo $v['portrait']?>" alt=""></div>
                <div class="">
                    <h1 class="f09"><?php echo $v['nickname']?></h1>
                    <p class="f07 pjdatatime"><?php echo $v['addtime']?></p>
                </div>
            </div>
            <div class="huifu">
                <p class="m5_0 f09">
                    <?php if ($v['parent_id'] > 0):?>
                        回复<span class="hongzi f10"><?php echo $v['parent_name']?>：</span>
                    <?php endif;?>
                    <?php echo $v['content']?>
                </p>
            </div>
        </div>
        <?php endforeach;?>
        <a href="<?php echo getUrl('find/comment?find_id='.$info['id'])?>" class="secletAllbtn mb10">查看全部评价</a>
    <?php  endif;?>
</div>

<div class="shopcarbox p3p">
    <div class="vCenter">
        <div class="zan heng vCenter f11 approval mr10">
            <?php if ($info['is_approval'] == 1):?>
                <img src="<?php echo $this->staticUrl?>img/png/pic87.png" alt="" class="heightimg approval_image">
            <?php else:?>
                <img src="<?php echo $this->staticUrl?>img/png/pic88.png" alt="" class="heightimg approval_image">
            <?php endif;?>
            <span class="cor9 f09 ml5 approval_number"><?php echo $info['approval']?></span>
        </div>
        <div class="f11 vCenter collection">
        <?php if ($info['is_collection'] == 1):?>
            <img src="<?php echo $this->staticUrl?>img/png/collect1.png" alt="" class="heightimg coll_image">
        <?php else:?>
            <img src="<?php echo $this->staticUrl?>img/png/collect2.png" alt="" class="heightimg coll_image">
        <?php endif;?>
    </div>
    </div>
    <div class="btnbox heng vCenter">
        <a href="<?php echo getUrl('find/comment?find_id='.$info['id'])?>" class="posbotbtn f09 mr5">发表评论<?php echo $info['is_collection']?></a>
        <a href="tel:<?php echo $info['mobile_og']?>" class="posbotbtn lanposbotbtn f09">拨打电话</a>
    </div>
</div>

</body>
<script src="<?php echo $this->staticUrl?>js/base.js"></script>
<script type="text/javascript">
    $(function () {
        var id = '<?php echo $info["id"]?>',
            is_collection = "<?php echo $info['is_collection']?>";

        // 点赞
        $(".approval").click(function () {
            blockUI.show();
            var approval_image;
            $.ajax('<?php echo getUrl('find/approval');?>', {
                dataType:'json',
                type:'post',
                data:{find_id:id},
                error:function(){
                    blockUI.hide();
                    show_message({status:0, message:'请求超时'});
                },
                timeout:60000,
                success:function(e,textStatus,jqXHR){
                    blockUI.hide();
                    show_message(e);
                    if (e.status == 1) {
                        if (e.data.is_approval == 1){
                            // 未点赞
                            approval_image = '<?php echo $this->staticUrl?>img/png/pic87.png';
                        }else{
                            // 已点赞
                            approval_image = '<?php echo $this->staticUrl?>img/png/pic88.png';
                        }
                        $(".approval_image").attr('src', approval_image);
                        $(".approval_number").html(e.data.approval);
                    }
                }
            });
        });

        $(".collection").click(function () {
            var coll_image,
                collUrl = '';
            if (is_collection == 1){
                collUrl = '<?php echo getUrl('user/saveCollection');?>';
            }else{
                collUrl = '<?php echo getUrl('user/rmCollection');?>';
            }
            $.ajax(collUrl, {
                dataType:'json',
                type:'post',
                data:{type:2,relation_id:id},
                error:function(){
                    blockUI.hide();
                    show_message({status:0, message:'请求超时'});
                },
                timeout:60000,
                success:function(e,textStatus,jqXHR){
                    blockUI.hide();
                    show_message(e);
                    if (e.status == 1) {
                        if (is_collection == 2){
                            // 取消收藏
                            coll_image = '<?php echo $this->staticUrl?>img/png/collect1.png';
                            is_collection = 1;
                        }else{
                            // 已收藏
                            coll_image = '<?php echo $this->staticUrl?>img/png/collect2.png';
                            is_collection = 2;
                        }
                        $(".coll_image").attr('src', coll_image);
                    }
                }
            });
        });
    })
</script>
</html>